package com.qiwx.pigeon.adapter.query;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.qiwx.pigeon.R;
import com.qiwx.pigeon.Utils.DateTimeUtils;
import com.qiwx.pigeon.data.vo.GetOutReccordBean;
import com.qiwx.pigeon.data.vo.QueryColumnNameBean;
import com.qiwx.pigeon.data.vo.QueryWareHouseBean;

import java.util.List;

/**
 * @description
 * @Author qiwx
 * @Date 2020-03-29 15:35
 * 鸽场查询 Adapter
 **/
public class QueryPigeonFactoryAdapter extends BaseQuickAdapter<QueryWareHouseBean, BaseViewHolder> {

    int type = 0;//1 是所有鸽仓 0是单个鸽仓

    public QueryPigeonFactoryAdapter(int layoutResId) {
        super(layoutResId);
    }

    public QueryPigeonFactoryAdapter(int type, int layoutResId, List<QueryWareHouseBean> data) {
        super(layoutResId, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder holder, QueryWareHouseBean bean) {
        int pos = holder.getLayoutPosition();
        if (pos == 0) {
            QueryColumnNameBean column = bean.getColumn();
            if (column == null)
                return;
            holder.setText(R.id.txt_column, "项目");
            holder.setText(R.id.layEggAmount, column.getLayEggAmount());
            holder.setText(R.id.badEggAmount, column.getBadEgg());
            holder.setText(R.id.eggAmount1,column.getEggAmount1());
            holder.setText(R.id.eggAmount2,column.getEggAmount2());
            holder.setText(R.id.wujing1,column.getWujing1());
            holder.setText(R.id.shoujing1,column.getShoujing1());
            holder.setText(R.id.sijing1,column.getSijing1());
            holder.setText(R.id.wujing2, column.getWujing2());
            holder.setText(R.id.sijing2, column.getSijing2());
            holder.setText(R.id.shoujing2, column.getShoujing2());
            holder.setText(R.id.shoujing2sijing1, column.getShoujing2sijing1());
            holder.setText(R.id.shoujing2wujing1, column.getShoujing2wujing1());
            holder.setText(R.id.wujing2sijing1, column.getWujing2sijing1());
            holder.setText(R.id.notfudan, column.getNotfudan());
            holder.setText(R.id.breakenEgg, column.getBreakenEgg());
            holder.setText(R.id.wudan, column.getWudan());
            holder.setText(R.id.chuke, column.getCkAmount());
            holder.setText(R.id.cunlan, column.getCunlan());
            holder.setText(R.id.deathAmount, column.getDeathAmount());
            holder.setText(R.id.chulan, column.getChulan());


        } else {
            if (bean.getWh_number() > 0) {
                if (type == 1) {
                    holder.setText(R.id.txt_column, bean.getWh_number() + "号仓");
                } else {
                    holder.setText(R.id.txt_column, "数量");
                }

            } else {
                holder.setText(R.id.txt_column, "合计");
            }

            holder.setText(R.id.layEggAmount, bean.getLayEggAmount()+"");
            holder.setText(R.id.badEggAmount, bean.getBadEgg()+"");
            holder.setText(R.id.eggAmount1,bean.getEggAmount1()+"");
            holder.setText(R.id.eggAmount2,bean.getEggAmount2()+"");
            holder.setText(R.id.wujing1,bean.getWujing1()+"");
            holder.setText(R.id.shoujing1,bean.getShoujing1()+"");
            holder.setText(R.id.sijing1,bean.getSijing1()+"");
            holder.setText(R.id.wujing2, bean.getWujing2()+"");
            holder.setText(R.id.sijing2, bean.getSijing2()+"");
            holder.setText(R.id.shoujing2, bean.getShoujing2()+"");
            holder.setText(R.id.shoujing2sijing1, bean.getShoujing2sijing1()+"");
            holder.setText(R.id.shoujing2wujing1, bean.getShoujing2wujing1()+"");
            holder.setText(R.id.wujing2sijing1, bean.getWujing2sijing1()+"");
            holder.setText(R.id.notfudan, bean.getBufudan()+"");
            holder.setText(R.id.breakenEgg, bean.getBreakenEgg()+"");
            holder.setText(R.id.wudan, bean.getWudan()+"");
            holder.setText(R.id.chuke, bean.getCkAmount()+"");
            holder.setText(R.id.cunlan, bean.getCunlan()+"");
            holder.setText(R.id.deathAmount, bean.getDeathAmount()+"");
            holder.setText(R.id.chulan, bean.getChulan()+"");
        }


    }
}
